package halilTest;

import java.io.IOException;
import java.net.DatagramPacket;

public class NodeReciever implements Runnable{

	private NodeH node;
	byte[] buf = new byte[521];
	DatagramPacket p = new DatagramPacket(buf, 512);
	
	public NodeReciever(NodeH node){
		this.node = node;
	}

	@Override
	public void run() {
		while(true){
			try {
				node.getSocket().receive(p);
				node.addMessage(new String(p.getData()));
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
		}
		
	}

}
